# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=gobject-introspection
pkgver=1.64.1
pkgrel=3
pkgdesc="Introspection system for GObject-based libraries"
url="https://wiki.gnome.org/action/show/Projects/GObjectIntrospection"
arch="all"
license="LGPL-2.0-or-later AND GPL-2.0-or-later AND MIT"
depends_dev="python3 cairo-dev libtool"
makedepends="$depends_dev glib-dev libffi-dev flex bison python3-dev meson"
subpackages="$pkgname-doc $pkgname-dev"
replaces="libgirepository"
checkdepends="sed"
source="https://download.gnome.org/sources/gobject-introspection/${pkgver%.*}/gobject-introspection-$pkgver.tar.xz
	musl-time64.patch
	"

build() {
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		. output
	ninja -C output
}

check() {
	ninja -C output test
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
}

dev() {
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/share "$subpkgdir"/usr/
	mv "$pkgdir"/usr/lib/gobject-introspection "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
	default_dev
	replaces="gobject-introspection"
}

sha512sums="7610871f7ed5778ea9813062ed6465d131af58c00bdea1bb51dde7f98f459f44ae453eb6d0c5bdc6f7dcd92d639816f4e0773ccd5673cd065d22dabc6448647c  gobject-introspection-1.64.1.tar.xz
a55df8fbb8d27d073bbab7e3bd2ca5e272c3fca2a3e144207d4cac06dd90f51443373b077fa64543887e2d5da4bc017bd5245473b83dd0ed551a5a437eec9241  musl-time64.patch"
